package com.harry.resource.inner.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.harry.basis.BasePoEntity;
import static com.harry.configuration.ConstSettings.*;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
public class InnerTemplate extends BasePoEntity {

	private static final long serialVersionUID = 1L;

	@Column(length = MEDIUM_LENGTH, nullable = false, updatable = false, unique = true)
	private String name;

	@Column(length = NARO_LENGTH, nullable = false, updatable = false)
	private String type;

	@Fetch(FetchMode.JOIN)
	@ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
	@JoinColumn
	private InnerFile file;

	@Column(columnDefinition = TEXT_COLUMN)
	private String content;

	@Column(columnDefinition = TEXT_COLUMN)
	private String variables;
}
